﻿using System;

namespace Fibre.Threading.Tests
{
    public class EndThrowsExceptionAsyncClass
    {
        public IAsyncResult BeginTest(AsyncCallback asyncCallback, object state)
        {
            var asyncResult = new AsyncResult<string>(asyncCallback, state);
            asyncResult.Complete("All good", true);
            return asyncResult;
        }

        public string EndTest(IAsyncResult asyncResult)
        {
            throw new InvalidOperationException("Something failed in async work");
        }
    }
}